package gui;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

public class RegisterPage extends JPanel {


	private static final long serialVersionUID = 7208767717812297804L;

	private JLabel nameLabel, passwordLabel;
	private JTextField nameTextField, passwordTextField;
	private JButton enterButton, cancelButton;
	
	
	public RegisterPage(GUI guiObject)
	{
		
		setLayout(new GridBagLayout());
		setMaximumSize(new Dimension(150, 100));
		nameLabel = new JLabel("Name");
		nameTextField = new JTextField();
		
		nameLabel.setPreferredSize(new Dimension(100, 20));
		nameTextField.setPreferredSize(new Dimension(100, 20));
		
		Constraints.setConstraints(0,0,1,1,1,1,GridBagConstraints.CENTER,
				GridBagConstraints.NONE, new Insets(0,0,0,2),0,0);
				
		add(nameLabel, Constraints.gbc);
		
		Constraints.setConstraints(1,0,1,1,1,1,GridBagConstraints.CENTER,
				GridBagConstraints.NONE, new Insets(0,0,0,2),0,0);
		
		add(nameTextField, Constraints.gbc);
		
		passwordLabel = new JLabel("Password");
		passwordTextField = new JPasswordField();
		
		passwordLabel.setPreferredSize(new Dimension(100, 20));
		passwordTextField.setPreferredSize(new Dimension(100, 20));
		
		Constraints.setConstraints(0,1,1,1,1,1,GridBagConstraints.CENTER,
				GridBagConstraints.NONE, new Insets(0,0,0,2),0,0);
				
		add(passwordLabel, Constraints.gbc);
		
		Constraints.setConstraints(1,1,1,1,1,1,GridBagConstraints.CENTER,
				GridBagConstraints.NONE, new Insets(0,0,0,2),0,0);
		
		add(passwordTextField, Constraints.gbc);
		
		enterButton = new JButton("Enter");
		cancelButton = new JButton("Cancel");
		
		enterButton.addActionListener(guiObject);
		enterButton.setActionCommand("enterregister");
		cancelButton.addActionListener(guiObject);
		cancelButton.setActionCommand("cancelregister");
		
		enterButton.setPreferredSize(new Dimension(100, 20));
		cancelButton.setPreferredSize(new Dimension(100, 20));
		
		Constraints.setConstraints(0,2,1,1,1,1,GridBagConstraints.CENTER,
				GridBagConstraints.NONE, new Insets(0,0,0,2),0,0);
				
		add(enterButton, Constraints.gbc);
		
		Constraints.setConstraints(1,2,1,1,1,1,GridBagConstraints.CENTER,
				GridBagConstraints.NONE, new Insets(0,0,0,2),0,0);
		
		add(cancelButton, Constraints.gbc);
	}
}
